package org.example.eatback.mappers;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.example.eatback.pojo.User;

@Mapper
public interface UserMapper {
    //查询
    @Select("select * from user where username = #{username}")
    User findByUser(String username);
    //新增
    @Insert("insert into user(username, password)" +"values  (#{username},#{password})")
    void add(String username, String password);

    @Select("SELECT * FROM user WHERE username = #{username}")
    User getUserInfo(String username);

    @Update("UPDATE user SET height = #{height}, weight = #{weight}, " +
            "gender = #{gender}, age = #{age} WHERE username = #{username}")
    void updateUserInfo(User user);
}
